package one.stand.controller;

import com.sun.org.apache.xpath.internal.operations.Bool;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import one.stand.aop.ApiController;
import one.stand.model.ResultModel;
import one.stand.request.essay.EssayTypeForm;
import one.stand.request.essay.EssayTypeRequest;
import one.stand.response.essay.EssayTypeResponse;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 获客文章类型相关业务
 * @author luoyang
 * @date 2020/5/6 16:40
 */
@RestController
@RequestMapping("crmPc/essayType")
@Api(description = "获客文章分类",tags="获客文章分类")
public class EssayTypeController extends BaseController{

    /**
     * 创建获客文章类型
     * @param request
     * @return
     */
    @ApiOperation(value = "创建获客文章类型")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeRequest.class)
    @PostMapping("add")
    public ResultModel  add(@RequestAttribute  EssayTypeRequest request){
        return this.crmFegin.addEassyType(request);
    }

    /**
     * 更新获客文章类型
     * @param request
     * @return
     */
    @ApiOperation(value = "更新获客文章类型")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeForm.class)
    @PostMapping("update")
    public ResultModel  update(@RequestAttribute EssayTypeForm request){
        return crmFegin.updateEassyType(request);
    }

    /**
     * 查询获客文章类型
     * @param request
     * @return
     */
    @ApiOperation(value = "查询获客文章类型")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeRequest.class)
    @PostMapping("queryById")
    public ResultModel  queryById(@RequestAttribute  EssayTypeRequest request){
        return crmFegin.queryEassyTypeById(request);
    }

    /**
     * 删除分类
     * @param request
     * @return
     */
    @PostMapping("deleteById")
    @ApiOperation(value = "删除分类")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeRequest.class)
    public ResultModel  deleteById(@RequestAttribute  EssayTypeRequest request){
        return crmFegin.deleteById(request);
    }

    /**
     * 分页查询获客文章类型
     * @param request
     * @return
     */
    @ApiOperation(value = "分页查询获客文章类型")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeRequest.class)
    @PostMapping("queryPage")
    public ResultModel queryPage(@RequestAttribute  EssayTypeRequest request){
        return crmFegin.queryPageEassyType(request);
    }

    @ApiOperation(value = "查询公司获客文章类型")
    @ApiController(isLogin = true, company = true,card = true,paramClass = EssayTypeRequest.class)
    @PostMapping("queryAllType")
    public ResultModel queryAllType(@RequestAttribute  EssayTypeRequest request){
        return crmFegin.queryAllType(request);
    }



}
